home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / nroff~06.zoo / nroff.h < prev    next >
C/C++ Source or Header  |  1992-07-17  |  18KB  |  618 lines

  1. #ifndef NRO_H
  2. #define NRO_H
  3.  
  4. /*
  5.  * $Id: nroff.h,v 1.2 1992/07/16 10:38:32 rosenkra Exp $
  6.  *
  7.  * $Log: nroff.h,v $
  8.  * Revision 1.2  1992/07/16  10:38:32  rosenkra
  9.  * port to gcc, add tm,ie,el
  10.  *
  11.  */
  12.  
  13. #include "config.h"            /* os/compiler options */
  14.  
  15. /*
  16.  *    nroff.h - stuff for nroff
  17.  *
  18.  *    adapted for atariST/TOS by Bill Rosenkranz 10/89
  19.  *    net:    rosenkra@hall.cray.com
  20.  *    CIS:    71460,17
  21.  *    GENIE:    W.ROSENKRANZ
  22.  *
  23.  *    things to look for here:
  24.  *    1) TMAC definition for default macro package lib
  25.  *    2) configuration sizes (see _STKSIZ below if alcyon/dri)
  26.  *    3) libc should have getenv(), time(), and ctime()
  27.  *    4) look in version.h for *printer file name (included below)
  28.  *
  29.  *    all data is currently allocated in static arrays. the biggest
  30.  *    chunks are the parameters which control number registers and the
  31.  *    macro name space area. these are defined below: MAXREGS, MACBUF.
  32.  *    MACBUF is the larger. it holds all macros, strings, etc. if you
  33.  *    find yourself running out of macro space, increase MACBUF.
  34.  *
  35.  *    original author:
  36.  *
  37.  *    Stephen L. Browning
  38.  *    5723 North Parker Avenue
  39.  *    Indianapolis, Indiana 46220
  40.  *
  41.  *    history:
  42.  *
  43.  *    - Originally written in BDS C;
  44.  *    - Adapted for standard C by W. N. Paul
  45.  *    - Heavily hacked up to conform to "real" nroff by Bill Rosenkranz
  46.  */
  47.  
  48. #ifdef __GNUC__
  49. #include <types.h>
  50. #include <time.h>
  51. #include <stdlib.h>
  52. #include <string.h>
  53. #include <unistd.h>
  54. #endif
  55. #include <ctype.h>
  56.  
  57. /*
  58.  *    default prefix of macro files. files will be of the form "tmac.an"
  59.  *    (for -man), "tmac.s" (for -ms), "tmac.e" (for -me), etc. first
  60.  *    checks environment for TMACDIR which would be path (e.g. "c:\lib\tmac"
  61.  *    or ".", no trailing slash char!).
  62.  */
  63. #ifdef tmacfull
  64. # define TMACFULL    tmacfull
  65. #endif
  66. #ifdef tmacpre
  67. # define TMACPRE    tmacpre
  68. #endif
  69.  
  70. #ifdef GEMDOS
  71. # ifndef TMACFULL
  72. #  define TMACFULL    "c:\\lib\\tmac\\tmac.\0\0\0\0                          "
  73. # endif
  74. # ifndef TMACPRE
  75. #  define TMACPRE    "\\tmac.\0\0\0\0                                       "
  76. # endif
  77. #endif
  78.  
  79. #ifdef MINIX
  80. # ifndef TMACFULL
  81. #  define TMACFULL    "/usr/lib/tmac/tmac."
  82. # endif
  83. # ifndef TMACPRE
  84. #  define TMACPRE    "/tmac."
  85. # endif
  86. #endif
  87.  
  88. #ifdef UNIX
  89. # ifndef TMACFULL
  90. #  define TMACFULL    "/usr/lib/tmac/tmac."
  91. # endif
  92. # ifndef TMACPRE
  93. #  define TMACPRE    "/tmac."
  94. # endif
  95. #endif
  96.  
  97. /*
  98.  *    command codes. indented defines are commands not yet implemented
  99.  */
  100. #undef PI
  101. #define MACRO        0    /* macro definition */
  102. #define BP         1    /* begin page */
  103. #define BR         2    /* break */
  104. #define CE         3    /* center */
  105. #define FI         4    /* fill    */
  106. #define FO         5    /* footer */
  107. #define HE         6    /* header */
  108. #define IN         7    /* indent */
  109. #define LS         8    /* line spacing    */
  110. #define NF         9    /* no fill */
  111. #define PL        10    /* page length */
  112. #define RM        11    /* remove macro */
  113. #define SP        12    /* line space */
  114. #define TI        13    /* temp indent */
  115. #define UL        14    /* underline */
  116. #define JU        15    /* justify */
  117. #define NJ        16    /* no justify */
  118. #define M1        17    /* top margin */
  119. #define M2        18    /* second top margin */
  120. #define M3        19    /* first bottom margin */
  121. #define M4        20    /* bottom-most margin */
  122. #define BS        21    /* allow/disallow '\b' in output */
  123. #define NE        22    /* need n lines */
  124. #define PC        23    /* page number character (%) */
  125. #define CC        24    /* control character (.) */
  126. #define PO        25    /* page offset */
  127. #define BO        26    /* bold face */
  128. #define EH        27    /* header for even numbered pages */
  129. #define OH        28    /* header for odd numbered pages */
  130. #define EF        29    /* footer for even numbered pages */
  131. #define OF        30    /* footer for odd numbered pages */
  132. #define SO        31    /* source file */
  133. #define CU        32    /* continuous underline    */
  134. #define DE        33    /* define macro    */
  135. #define EN        34    /* end macro definition    */
  136. #define NR        35    /* set number register */
  137. #define EC        36    /* escape character (\) */
  138. #define FT        37    /* font change (R,B,I,S,P) */
  139. #define EO        38    /* turn escape parsing off */
  140. #define LL        39    /* line length (same as RM) */
  141. #define FL        40    /* flush output NOW */
  142. #define PN        41    /* page number for next page */
  143. #define RR        42    /* remove register */
  144. #define C2        43    /* nobreak char */
  145. #  define TR        44    /* translate character */
  146. #define LT        45    /* length of title */
  147. #  define FC        46    /* field delimeter */
  148. #define TL        47    /* like HE */
  149. #define AF        48    /* assign format to nr */
  150. #define AD        49    /* adjust line */
  151. #define NA        50    /* no adjust */
  152. #define DS        51    /* define string */
  153. #define PM        52    /* print macro names */
  154. #define IF        53    /* if */
  155. #define IE        54    /* if/else */
  156. #define EL        55    /* else */
  157. #define PS        56    /* point size (IGNORED in nroff) */
  158. #define SS        57    /* space char size (IGNORED in nroff) */
  159. #define CS        58    /* constant char space (IGNORED in nroff) */
  160. #define BD        59    /* embolden font (IGNORED in nroff) */
  161. #  define FP        60    /* font position */
  162. #  define MK        61    /* mark vertical place */
  163. #  define RT        62    /* return to marked vert place */
  164. #  define VS        63    /* vertical baseline spacing */
  165. #  define SV        64    /* save vertical distance */
  166. #  define OS        65    /* output saved vertical distance */
  167. #  define NS        66    /* no-space mode */
  168. #  define RS        67    /* restore spacing mode */
  169. #  define AM        68    /* append to macro */
  170. #  define AS        69    /* append to string */
  171. #  define RN        70    /* rename */
  172. #  define DI        71    /* divert to macro */
  173. #  define DA        72    /* divert/append to macro */
  174. #  define WH        73    /* set location trap */
  175. #  define CH        74    /* change trap location */
  176. #  define DT        75    /* set diversion trap */
  177. #  define IT        76    /* set input line trap */
  178. #define EM        77    /* end macro */
  179. #  define TA        78    /* tab settings */
  180. #  define TC        79    /* tab repetition char */
  181. #  define LC        80    /* leader repetition char */
  182. #define LG        81    /* ligature mode */
  183. #  define UF        82    /* underline font */
  184. #define NH        83    /* no hyphenation */
  185. #define HY        84    /* hyphenate */
  186. #define HC        85    /* hyphenation indication char */
  187. #define HW        86    /* hyphenation exception words */
  188. #  define NM        87    /* number mode */
  189. #  define NN        88    /* no number next lines */
  190. #  define EV        89    /* environment switch */
  191. #  define RD        90    /* read insertion */
  192. #define EX        91    /* exit */
  193. #  define NX        92    /* next file */
  194. #  define PI        93    /* pipe to program */
  195. #define MC        94    /* set margin char */
  196. #define TM        95    /* print to terminal */
  197. #define IG        96    /* ignore */
  198. #define SL        201    /* string length (extension) */
  199.  
  200. #define COMMENT        1000    /* comment (.\") */
  201. #define UNKNOWN        -1
  202.  
  203.  
  204. /*
  205.  *    MAXLINE is set to a value slightly larger than twice the longest
  206.  *    expected input line. Because of the way underlining is handled, the
  207.  *    input line which is to be underlined, can almost triple in length.
  208.  *    Unlike normal underlining and boldfacing, continuous underlining
  209.  *    affects all characters in the buffer, and represents the worst case
  210.  *    condition.  If the distance between the left margin and the right
  211.  *    margin is greater than about 65 characters, and continuous underlining
  212.  *    is in effect, there is a high probability of buffer overflow.
  213.  */
  214. #define MAXLINE        500        /* 200 */
  215. #define PAGELEN         66
  216. #define PAGEWIDTH     80
  217. #define HUGE        256
  218. #define INFINITE    32760
  219. #define LEFT        0    /* indecies into hdr margin lim arrays */
  220. #define RIGHT        1
  221. #define Nfiles        4    /* nesting depth for input files */
  222.  
  223. /*
  224.  *    The following parameters may be defined elsewhere so undef/def
  225.  */
  226. #undef min
  227. #undef max
  228. #undef YES
  229. #define YES        1
  230. #undef NO
  231. #define NO        0
  232. #undef ERR
  233. #define ERR        -1
  234. #define EOS         '\0'
  235. #undef FALSE
  236. #define FALSE         0
  237. #undef TRUE
  238. #define TRUE         !FALSE
  239. #undef OK
  240. #define OK         !ERR
  241.  
  242. /*
  243.  *    a rational way of dealing with the NULL thing...
  244.  */
  245. #define NULL_CPTR    (char *) 0
  246. #define NULL_FPTR    (FILE *) 0
  247. #define NULL_IPTR    (int *) 0
  248. #define NULL_LPTR    (long *) 0
  249. #define NULL_SPTR    (short *) 0
  250. #define NULL_PTR    (char *) 0
  251. #define NULLP(type)    (type *) 0
  252.  
  253.  
  254. /*
  255.  *    for justification during line fill
  256.  */
  257. #define ADJ_OFF        0
  258. #define ADJ_LEFT    1
  259. #define ADJ_RIGHT    2
  260. #define ADJ_CENTER    3
  261. #define ADJ_BOTH    4
  262.  
  263.  
  264. /*
  265.  *    basic unit (b.u.) conversions. in nroff, all output is fixed spaced,
  266.  *    at least in THIS nroff. so unit conversion to b.u. amount to 1 Em per
  267.  *    character or 24 b.u. per character. thus 0.5i = 12